package au.com.iglootech.TaxTimeToolTip.Entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.Order;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.Queries;
import javax.jdo.annotations.Query;
import javax.persistence.Transient;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
@Queries({
    @Query(name = Invoice.FIND_UNPAID, value = "SELECT FROM Invoice invoice where isPaid == false"),
    @Query(name = Invoice.FIND_BY_INVOICE_NUMBER, value = "SELECT FROM Invoice invoice where invoiceNumber == :pInvoiceNumber")
})
public class Invoice implements IGTDomainEntity {
	@Transient
	public static final String FIND_UNPAID = "findUnpaid";
	@Transient
	public static final String FIND_BY_INVOICE_NUMBER = "findByInvoiceNumber";
	
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;
    @Persistent
	private Integer invoiceNumber;
    @Persistent
    private Boolean isPaid;
    @Persistent
    private Date paidDate;
    @Persistent
    private String paidBy;
    @Persistent
    private String comment;
    @Persistent
    private String details;
    @Persistent
    private List<Key> taskSets = new ArrayList<Key>(); 
	
	public Invoice()
	{
		
	}

	public Key getKey() {
		return key;
	}

	public void setKey(Key key) {
		this.key = key;
	}

	public Integer getInvoiceNumber() {
		return invoiceNumber;
	}

	public void setInvoiceNumber(Integer invoiceNumber) {
		this.invoiceNumber = invoiceNumber;
	}

	public Boolean getIsPaid() {
		return isPaid;
	}

	public void setIsPaid(Boolean isPaid) {
		this.isPaid = isPaid;
	}

	public Date getPaidDate() {
		return paidDate;
	}

	public void setPaidDate(Date paidDate) {
		this.paidDate = paidDate;
	}

	public String getPaidBy() {
		return paidBy;
	}

	public void setPaidBy(String paidBy) {
		this.paidBy = paidBy;
	}

	public List<Key> getTaskSets() {
		return taskSets;
	}

	public void setTaskSets(List<Key> taskSets) {
		this.taskSets = taskSets;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getDetails() {
		return details;
	}

	public void setDetails(String details) {
		this.details = details;
	}

}
